<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件

function pre($array){
    echo "<pre>";
    print_r($array);
    echo "</pre>";

}
 function user()
{
    if(\think\Cookie::has("user_id")||\think\Cookie::has("user")){
//        echo "user_id存在";
        if(\think\Cookie::has("user_id")){
            $array["head_img_url"]="<a href='".url("Personal/personal_center")."?id=".$_COOKIE["user_id"]."'>
        <img  class='head_img' src='"."__IMAGES__"."/".$_COOKIE["head_img"]. "' ></a>
        <a href='".url('Index/cancellation')."' class='navbar-link'>注销 </a>";
        }else{
            $array["head_img_url"]="<a href='".url("Personal/personal_center")."?id=".$_COOKIE["user_id"]."'>
         <img  class='head_img' src=".$_COOKIE["head_img"]. " ></a>
         <a href='".url('Index/cancellation')."' class='navbar-link'>注销 </a>";

        }
//        $array["head_img_url"]=\think\Cookie::has("user_id")."1";
    }else{
//        echo "user不存在";
        $array["head_img_url"]="<a href='".url('Index/login')."' class='navbar-link'>登录 </a>";
    }
    return $array;
}



function admin_power(){
    $power = \think\Cookie::get('power');
    if($power == 1){
        return true;
    }else if($power == 0){
        return false;
    }
}


















